package com.shigen.file.req;

import com.shigen.file.common.PageRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

/**
 * 问卷的查询参数
 *
 * @author shigenfu
 * @date 2022/6/4 10:42 下午
 */
public class ProjectRequest {

  /**
   * 根据问卷名称分页查询
   */
  @Data
  public static class QueryByName extends PageRequest {

    /**
     * 问卷名称
     */
    @Length(max = 10, message = "问卷名称的长度不能超过10")
    private String name;
  }

  /**
   * 问卷的创建
   */
  @Data
  @Accessors(chain = true)
  @ApiModel(value = "问卷的创建")
  public static class Create {

    @ApiModelProperty(value = "问卷的名字")
    @NotEmpty(message = "项目名称不能为空")
    private String projName;

    @ApiModelProperty(value = "每人只能填写一次 0----false 1----true")
    private boolean writeOnce;

    @ApiModelProperty(value = "开始时间")
    @NotEmpty(message = "开始时间不能为空")
    private String beginTime;

    @ApiModelProperty(value = "结束时间")
    @NotEmpty(message = "结束时间不能为空")
    private String endTime;

    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "描述")
    @NotEmpty(message = "描述文字不能为空")
    private String describe;

    @ApiModelProperty(value = "表单的组件")
    @NotEmpty(message = "表单控件不能为空")
    private String list;

    @ApiModelProperty(value = "表单的配置信息")
    private String config;

    @ApiModelProperty("表单数据提交后跳转地址")
    private String callbackUrl;
  }

  /**
   * 更新表单状态请求体
   */
  @Data
  @Accessors(chain = true)
  public static class UpdateStatusReq {

    /**
     * 项目id
     */
    @NotEmpty(message = "表单id不能为空")
    private String projId;
    /**
     * 表单收集状态
     */
    @NotNull(message = "表单的状态不能为空")
    private Boolean status;

  }

  @Data
  public static class DownloadDataReq {
    /**
     * 项目id
     */
    @NotEmpty(message = "表单id不能为空")
    private String projId;
    /**
     * 表单收集状态
     */
    @NotNull(message = "是否展示额外提交信息不能为空")
    private Boolean withAdditionInfo;
  }
}
